package DS0419;

public class sedQueue {
    private final int MAX=100;
    private Student arr[] = new Student[MAX];
    private int front=0;
    private int rear=0;

    public void enQueue(Student name){
        arr[rear] = name;
        rear++;
    }


    public void delQueue(){
        front++;
    }

    public int length(){
        return rear-front;
    }

    public void clear(){
        front=0;
        rear=0;
    }

    public void display(){
        if(front==rear){
            System.out.println("此表为空");
            return;
        }
        for (int i = front;i<rear;i++){
            System.out.print(arr[i] + "  " );
        }
        System.out.println();
    }

    public boolean empty(){
        return rear == front;
    }

    public Student element(){
        if(empty()){
            System.out.println("此队列为空");
        }
        return (Student)arr[front];
    }
}
